<!DOCTYPE html>
<html lang="en">
	<head>
		<title> New Document </title>
		<meta charset="utf-8">
		<meta name="Author" content="">
		<meta name="Keywords" content="">
		<meta name="Description" content="">
		<meta name="viewport" content="width=device-width, initial-scale=1.0">
		<!-- Bootstrap -->
		<link href="${webRoot}resources/css/bootstrap.min.css" rel="stylesheet" media="screen">
		<link href="${webRoot}resources/css/style.css" rel="stylesheet">
		<script src="http://code.jquery.com/jquery-1.10.0.min.js"></script>
		<style type="text/css">
		.black_overlay{
		display: none;
		position: absolute;
		top: 0%;
		left: 0%;
		width: 100%;
		height: 100%;
		background-color: black;
		z-index:1001;
		-moz-opacity: 0.8;
		opacity:.80;
		filter: alpha(opacity=80);
		}
		.white_content {
		display: none;
		position: absolute;
		top: 10%;
		left: 10%;
		width: 80%;
		height: 80%;
		border: 16px solid lightblue;
		background-color: white;
		z-index:1002;
		overflow: auto;
		}
		.white_content_small {
		display: none;
		position: absolute;
		top: 20%;
		left: 30%;
		width: 40%;
		height: 50%;
		border: 16px solid lightblue;
		background-color: white;
		z-index:1002;
		overflow: auto;
		}
	</style>
	</head>
<body class="main">
	<div class="wrap">
		<div class="">
		<ul class="breadcrumb">
		    <li><span id="test">您当前的位置：</span><a href="#">首页</a> <span class="divider">>></span></li>
		    <li class="active">${recommendsDataStatisticsList}</li>
	    </ul>
			<form class="form-inline" name="myForm">
				<input type="text" class="input-small" id="dateFrom" name="dateFrom" placeholder="推荐时间从">
				<input type="text" class="input-small" id="dateTo" name="dateTo" placeholder="推荐时间到">			
				<button type="button" class="btn" onclick="exportPartData();">导出该时间段数据</button>
				<button type="button" class="btn" onclick="exportData();">导出所有数据</button>
			</form>
		</div>
		<div id="div">
		<div class="">
			<table class="table table-bordered table-striped table-hover">
				<thead>
					<tr>
						<th>推荐内容</th>
						<th>推荐时间</th>
						<th>审核人数</th>
						<th>推荐总数</th>
						<!-- <th>注册用户推荐数</th>
						<th>游客推荐数</th> -->
					</tr>
				</thead>
				<tbody>
				<#if list?exists>
				<#list list as recommendEntity>
					<tr>
						<td>${recommendEntity.content}</td>
						<td>${recommendEntity.time?string("yyyy-MM-dd HH:mm:ss")}</td>
						<td>${recommendEntity.auditeCount}</td>
						<td><a href="javascript:userList(${recommendEntity.id})">${recommendEntity.rescore}</a></td>
						<!-- <td>${recommendEntity.mc1}</td>
						<td>${recommendEntity.mc2}</td> -->
					</tr>
				</#list>
				<#else>
				   	 <tr>
				       <td colspan="6">没有查询到记录！</td>
				   </tr>
				</#if>
				</tbody>
			</table>			
		</div>
		<#if list?exists>
		<div class="pagination pagination-right">
		  <input type="hidden" name="userSelectBean" id="userSelectBean" value="${memberEntity}"/>
		  <ul>
		    <#if pageEntity.page==1>
		    <li class="disabled"><a href="#">&laquo;</a></li>
		    <#else>
		    <li><a href="javascript:pageHref(${pageEntity.page-1},${pageEntity.totalPage},${pageEntity.pageSize})">&laquo;</a></li>
		    </#if>
		    <#list 1..pageEntity.totalPage as i>
		         <#if pageEntity.page==i>
		    <li class="active"><a href="#">${i}</a></li>
		         <#else>
		    <li><a href="javascript:pageHref(${i},${pageEntity.totalPage},${pageEntity.pageSize})">${i}</a></li>
		        </#if>
		    </#list>
		   <#if pageEntity.page==pageEntity.totalPage>
		    <li class="disabled"><a href="#">»</a></li>
		    <#else>
		    <li><a href="javascript:pageHref(${pageEntity.page+1},${pageEntity.totalPage},${pageEntity.pageSize})">»</a></li>
		    </#if>
		  </ul>
		</div>
		</#if>
		</div>				
	</div>	
		<!--弹出层时背景层DIV-->
<div id="fade" class="black_overlay">
</div>
<div id="MyDiv" class="white_content">
</div>			
	<script src="${webRoot}resources/js/bootstrap.min.js"></script>
	<script src="${webRoot}resources/js/js.js"></script>
	<script type="text/javascript">
	    function pageHref(page,totalPage,pageSize){
	    	var userBean = $("#userSelectBean").val();
	    	$.ajax({url:"${webRoot}recommends/recommendsDataStatisticsAjaxList.do?page="+page+"&pageSize="+pageSize+
	    			"&totalPage="+totalPage,
				   type:"post",
				   cache:"false",
				   error : function() {
					   alert("系统繁忙，请稍后再试！");
					},
				   success:function(msg){
					   $(".main").html(msg);
				   }
				});
	    }
	    
	    function userList(id){
	    	$.ajax({url:"${webRoot}user/partUserList.do?recommendId="+id,
				   type:"post",
				   cache:"false",
				   error : function() {
					   alert("系统繁忙，请稍后再试！");
					},
				   success:function(msg){
					  	$("#MyDiv").html(msg);
						ShowDiv('MyDiv','fade');
				   }
				});
	    }
	    function exportPartData(){
	    	var dateFrom = $("#dateFrom").val();
	    	var dateTo = $("#dateTo").val();
	    	if($.trim(dateFrom) == null ||$.trim(dateFrom) =="" ){
				alert("推荐时间从不能为空！");
				return ;
			}else if($.trim(dateTo) == null ||$.trim(dateTo) =="" ){
				alert("推荐时间到不能为空！");
				return ;
			}else{
				document.myForm.action="${webRoot}recommends/recommendsPartExport.do?dateFrom="+dateFrom+"&dateTo="+dateTo;
				document.myForm.submit();
			}
			
	    }
	    function exportData(){
	    	document.myForm.action="${webRoot}recommends/recommendsExport.do";
			document.myForm.submit();
	    }
	    function serachHref(){
	    	var userName = $("#userName").val();
	    	var userTelephone = $("#usertelephone").val();
	    	$.ajax({url:"${webRoot}member/memberAjaxList.do?member_Nick_Name="+userName+"&member_Phone="+userTelephone,
				   type:"post",
				   cache:"false",
				   error : function() {
					   alert("系统繁忙，请稍后再试！");
					},
				   success:function(msg){
					   $("#div").html(msg);
				   }
				});
	    }
	    function deleteRecommends(id){
				if(confirm("确定删除该推荐内容吗？")){
			    	$.ajax({url:"${webRoot}recommends/deleteRecommends.do?recommendId="+id,
						   type:"delete",
						   cache:"false",
						   error : function() {
							   alert("系统繁忙，请稍后再试！");
							},
						   success:function(msg){
							   $(".main").html(msg);
						   }
						});
					}
		}
	    function pageComment1(page,totalPage,pageSize){
	    var id = $("#id").val();
	    	$.ajax({url:"${webRoot}user/partUserAjaxList.do?page="+page+"&pageSize="+pageSize+
	    			"&totalPage="+totalPage+"&recommendId="+id,
				   type:"post",
				   cache:"false",
				   error : function() {
					   alert("系统繁忙，请稍后再试！");
					},
				   success:function(msg){
					   $("#MyDiv").html(msg);
						   ShowDiv('MyDiv','fade');
				   }
				});
	    }
	    function auditeList(id){
		    	$.ajax({url:"${webRoot}recommends/auditeList.do?recommendId="+id,
					   type:"post",
					   cache:"false",
					   error : function() {
						   alert("系统繁忙，请稍后再试！");
						},
					   success:function(msg){
						   $("#MyDiv").html(msg);
						   ShowDiv('MyDiv','fade');
					   }
					});
	}
	//弹出隐藏层
	function ShowDiv(show_div,bg_div){
	document.getElementById(show_div).style.display='block';
	document.getElementById(bg_div).style.display='block' ;
	var bgdiv = document.getElementById(bg_div);
	bgdiv.style.width = document.body.scrollWidth;
	// bgdiv.style.height = $(document).height();
	$("#"+bg_div).height($(document).height());
	};
	//关闭弹出层
	function CloseDiv(show_div,bg_div)
	{
	document.getElementById(show_div).style.display='none';
	document.getElementById(bg_div).style.display='none';
	};
	</script>
</body>
</html>
